#if($action=="edit")
#set($title = "修改帖子")
#else
#set($title = "发表回复")
#end
#if($type=="reply")
#set($hidepost = $reply.ishidepost)
#else
#set($hidepost = $topic.ishidepost)
#set($replynotice = $topic.isreplynotice)
#set($topscope = $topic.topscope)
#end
#parse("/home/parseHeader.html")
<form id="form" method="POST" name="form" action='/forum/boards/$encrypt.encrypt("$!boardId")/$encrypt.encrypt("$!topicId")' enctype="multipart/form-data">
	<input type="hidden" value='$encrypt.encrypt("$!topicId")' name="topicId">
	<input type="hidden" value="$!boardId" name='boardid'>	
    <div class="mainbox formbox">
        <span class="headactions"><a class="notabs" href="/help/credits" target="_blank">查看积分策略说明</a></span>
        <h1 id="h1Title">$title</h1>
        <table id="post_tb" cellSpacing="0" cellPadding="0">
            <tbody>
                <tr>
                    <td style="width:168px">
                        用户名
                    </td>
                    <td>
                        $display.alt($!currentUser,"游客")
                    </td>
                </tr>
                <tr>
                    <th style="BORDER-BOTTOM-WIDTH: 0px">
                        <label for="subject">
                            标题
                        </label>
                    </th>
                    <td style="BORDER-BOTTOM-WIDTH: 0px">
                        <input id="subject" tabindex="2" size="50" name="subject" value="$!replyTitle $!reply.title $!topic.title" >
                    </td>
                </tr>
                <tr>
                    <th valign="top">
                        #parse("/post/_smile.html")
						<input type="hidden" id="post" name="post">
                    </th>
                    <td style="BORDER-BOTTOM-WIDTH: 0px"  valign="top">
                        <textarea id="postContent" name="postContent">
                        	$!quote $!topic.content $!reply.content
                        </textarea>
                        <table class="box" cellspacing="0" cellpadding="0" style="table-layout:fixed">
                            <thead>
                                <tr>
                                    <td style="width:300px;">
                                        上传附件或图片 ( 文件总尺寸应小于 <strong>5000 KB</strong>
                                        )
                                    </td>
                                    <td>
                                        下载所需积分
                                    </td>
                                    <td>
                                        &nbsp;描述
                                    </td>
                                </tr>
                            </thead>
                            <tbody id="attachitem" style="DISPLAY: none">
                                <tr>
                                    <th style="width:300px;">
                                        <input type="file" name="attachfile" size="40"><span id="localfile"></span>
                                    </th>
                                    <td class="nums">
                                        <input size="10" name="attachcredits" value="0">
                                    </td>
                                    <td>
                                        &nbsp;<input size="30" name="attachtitle" maxlength="50"><input type="hidden" id="hiddenValue" value="$hiddenValue">
                                    </td>
                                </tr>
                            </tbody>
                            <tbody id="attachbody">
                            	#if($action=="edit")
                            	#foreach($attach in $attaches)
								#parse("/reply/_attach.html")
								#end
								#end
                                <tr>
                                    <th style="width:300px;">
                                        <input type="file" name="attach_$hiddenValue" size="40" id="attach_$hiddenValue"><span id="localfile_$hiddenValue"></span>
                                    </th>
                                    <td class="nums">
                                        <input size="10" name="attachcredits_$hiddenValue" value="0" id="attachcredits_$hiddenValue">
                                    </td>
                                    <td>
                                        &nbsp;<input size="30" name="attachtitle_$hiddenValue" maxlength="50" id="attachtitle_$hiddenValue">
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </td>
                </tr>
                <tr class="btns">
                    <th>
                        &nbsp;
                    </th>
                    <td height="50">
                    <table cellspacing="0" cellpadding="0" border="0">
                        <tbody>
                            <tr>
                                <td style="padding-left:0px;">
                                    <button id="postbtn" tabindex="9" name="post_topic" type="submit">
                                       #if($action=="post") 发表回复 #elseif($action=="edit")修改帖子#end
                                    </button>
                                    <span id="postmsg" style="color:#009900"></span>
                                </td>
                                <td align="right">
                                    当您离开本页面时，表格的数据会被自动保存在缓存中 &nbsp;&nbsp;<a href="/" id="loadDate">恢复上次自动保存的数据</a>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                    </tbody>
                </table>
                </div>
            </form>
			 #includeJqueryUI
			#parse("/post/_dialog.html")         
            <script type="text/javascript">
	        var login=$!login;
		    var type="$!type";
		     var action="$!action";
			 $(function(){
			 	 if(type==="reply"){
		         $("#form").attr("action",'/forum/boards/$encrypt.encrypt("$!boardId")/$encrypt.encrypt("$!topicId")/$encrypt.encrypt("$!replyId")');
				 $("#isReplyNotice").hide();
				 $("#isTopPost").hide();
		         }
		        if(action==="edit"){
				 	$("#form").attr("action",$("#form").attr("action")+"/edit");				
	            }
				else if(action==="post"){
				
				}
			 });
		       
                            
            </script>
            #includeJs(["ckeditor/ckeditor","jquery.validate","ajaxfileupload","reply/reply"])
         
